package com.dries.portal.module.portal.controller;

import com.dries.common.api.CommonResult;
import com.dries.portal.module.portal.entity.DiscussDetail;
import com.dries.portal.module.portal.service.IDiscussDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;

/**
 * 用户评价详情表
 *
 * @author dries
 * @email samphsanie@gmail.com
 * @date 2020-08-07 13:37:44
 */
@Api(tags = "用户评价详情", value = "DiscussDetailController")
@RestController
@RequestMapping("/portal/discuss/detail")
public class DiscussDetailController {

    @Resource
    private IDiscussDetailService discussDetailService;

    /**
     * 列表
     */

    @GetMapping("/list")
    public CommonResult list(){
        return CommonResult.success();
    }

    /**
     * 信息
     */
    @ApiOperation("用户评价详情")
    @GetMapping("/info/{id}")
    public CommonResult info(@PathVariable("id") Integer id){

        // DiscussDetail discussDetail = discussDetailService.getById(id);

        return discussDetailService.getDiscussDetailById(id);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public CommonResult save(@RequestBody DiscussDetail discussDetail){
		discussDetailService.save(discussDetail);

        return CommonResult.success();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public CommonResult update(@RequestBody DiscussDetail discussDetail){
		discussDetailService.updateById(discussDetail);

        return CommonResult.success();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public CommonResult delete(@RequestBody Integer[] ids){
		discussDetailService.removeByIds(Arrays.asList(ids));

        return CommonResult.success();
    }

}
